class Lottery {
    constructor(options) {
        this.options = options;
        this.isRunning = false;
        this.result = null;
    }

    start() {
        if (this.isRunning) return;
        this.isRunning = true;
        console.log('Lottery started');
    }

    stop() {
        if (!this.isRunning) return;
        this.isRunning = false;
        this.result = this.options.prizes[Math.floor(Math.random() * this.options.prizes.length)];
        console.log('Lottery stopped');
    }

    getResult() {
        return this.result;
    }
}

const MyLottery = {
    create(options) {
        return new Lottery(options);
    }
};

if (typeof window !== 'undefined') {
    window.MyLottery = MyLottery;
}

export default MyLottery;